* Code for data analysis
drop if Year>2011
encode Nobelist, gen(Nobelist_num)
encode Wave, gen(wave_num)
drop Nobelist Wave 
rename Nobelist_num 	Nobelist
rename wave_num			Wave
format %8.0g Year-perzentil_necon T-webal webal_log Wave Nobelist  coarse_PY
gen double ID2 = ID + Nobelist*1000000000
xtset ID2 Year
gen D = Year > Nobelyear & T==1
gen age = Year - PY
ssc install center, replace
center age, standardize
gen logn = log(n + 1)

*** Model 1-3 in Table 3: Baseline FE models with SE clustered around Nobelist [same models estimated for wave 2 & wave 3 in Table 4]
xtreg logn D if T==1, fe vce(cluster Nobelist)
	est store m0_T
xtreg logn D [pweight=webal_log],  fe vce(cluster Nobelist)
	est store m1_TC
xtreg logn D c.c_age##c.c_age##c.c_age [pweight=webal_log], fe vce(cluster Nobelist)
	est store m2_TC
xtreg logn D c.c_age##c.c_age##c.c_age i.Year  [pweight=webal_log], fe vce(cluster Nobelist)
	est store m2_TC_year
esttab 	m1_TC m2_TC m2_TC_year, ///
		drop(19** 20**) stats(N N_g ll aic bic) label star(+ 0.10 * 0.05 ** 0.01 *** 0.001) mtitles(T1 T2 T3 TC1 TC2 TC3 TCY1 TCY2 TCY3)
		
*** Model 4 in Table 3: Dummy Impact Function
gen D0 = 	Year == Nobelyear 		& T==1
gen D1 = 	Year == (Nobelyear+1) 	& T==1
gen D2 = 	Year == (Nobelyear+2)   & T==1
gen D3 = 	Year == (Nobelyear+3) 	& T==1
gen D4 = 	Year == (Nobelyear+4)  	& T==1
gen D5_more = Year > (Nobelyear+4) 	& T==1
xtreg logn D0-D4 D5_more c.c_age##c.c_age##c.c_age i.Year  [pweight=webal_log], fe vce(cluster Nobelist)
	est store m2_TC_year_dummy_impact2
esttab, drop(19** 20**)  stats(N N_g ll aic bic) label star(+ 0.10 * 0.05 ** 0.01 *** 0.001) 
drop D0 - D5_more

*** Model 5 in Table 3:  Publication Year
gen diff = Nobelyear-PY
gen diff5 = (diff<=5)
gen diff6_more = (diff>5 & diff<.)
gen D_diff5 = (diff5==1 & D==1)
gen D_diff6_more = (diff6_more==1 & D==1)
xtreg logn D_diff5 D_diff6_more diff5#i.Year c.c_age##c.c_age##c.c_age [pweight=webal_log], fe vce(cluster Nobelist)
esttab 		,keep(D* _cons) stats(N N_g ll aic bic r_w r_o) label star(+ 0.10 * 0.05 ** 0.01 *** 0.001)

*** Model 6 in Table 3: Top 5% highly cited

gen top5_n = (perzentil==15)
gen D_top5n 	= 	(top5_n==1 & D==1)
gen D_restn 	= 	(top5_n==0 & D==1)
recode Year (1951/1959=1960) (1961/1969=1970) (1971/1979=1980), gen(Year_cat3)
quietly: xtreg logn D_top5n D_restn top5_n#i.Year_cat3 c.c_age##c.c_age##c.c_age [pweight=webal_log], fe vce(cluster Nobelist)
esttab 		,keep(D* _cons) stats(N N_g ll aic bic r_w r_o) label star(+ 0.10 * 0.05 ** 0.01 *** 0.001)

*** Model 7 in Table 3: high impact Journal
merge m:1 Nobelyear J1 using "C:\Users\yx94olob\Dropbox\Aktuelle Projekte\Desktop\Projekte\Farys Wolbring WoS and NobelPrize\Farys Wolbring Web of Science Daten\JIF.dta"
JIF.dta
drop if _merge==2
drop zaehler nenner 
drop _merge
recode jif top1 top5 top10 (. = 0)

capture gen D_top5_jif = (top5 ==1 & D==1)
capture gen D_rest_jif = (top5 ==0 & D==1)
gen top5_time=top5*Year

xtreg logn D_top5_jif D_rest_jif top5#i.Year_cat3 c.c_age##c.c_age##c.c_age [pweight=webal_log], fe vce(cluster Nobelist)
esttab 		,keep(D* _cons) stats(N N_g ll aic bic r_w r_o) label star(+ 0.10 * 0.05 ** 0.01 *** 0.001)

*** Model 8 & 9 in Table 3: Reaction by audience
gen log_econ = log(n_econ + 1)
gen log_ssci = log(n_ssci + 1)
gen D_Econ=D
gen D_SSCI=D
xtreg log_econ D_Econ i.Year c.c_age##c.c_age##c.c_age [pweight=webal_log], fe vce(cluster Nobelist)
	est store m1_econ_logn
xtreg log_ssci D_SSCI i.Year c.c_age##c.c_age##c.c_age [pweight=webal_log], fe vce(cluster Nobelist)
	est store m1_ssci_logn
esttab 		m1_econ_logn 	m1_ssci_logn, ///
			keep(D* _cons) stats(N N_g ll aic bic r_w r_o) label star(+ 0.10 * 0.05 ** 0.01 *** 0.001) ///
			mtitles(N:Econ N:NECON N:SSCI LOG-N:Rest N:Econ N:NECON N:SSCI LOG-N:Rest)
			
*** Figure 1 (same for wave 2 &3 in Figure A2 (a) and (b) )
preserve
gen process_time = Year-Nobelyear
sum process_time
drop if process_time>9
collapse n [pweight=webal], by(process_time T)
line n process_time if T==1, ///
|| line n process_time if T==0, ///
  yscale(range(0 30))  xline(0) ///
 graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white)) legend(off)
restore
*** Figure A1 
preserve
collapse n [pweight=webal], by(Nobelyear Year T)
foreach num of numlist 2000/2010{
line n Year if Nobelyear==`num' & T==1, lcolor(black) lpattern(solid) ///
|| line n Year if Nobelyear==`num' & T==0, lcolor(black) lwidth(medthick) lpattern(dot) ///
 xline(`num', lpattern(dash) lcolor(black)) saving(graph`num'.gph, replace) title(Nobel Prize `num', color(black)) ///
 graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white)) ytitle("") legend(off)
}
graph combine 	graph2000.gph graph2001.gph graph2002.gph ///
				graph2003.gph graph2004.gph graph2005.gph ///
				graph2006.gph graph2007.gph graph2008.gph graph2009.gph graph2010.gph, col(3)  graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white))
foreach num of numlist 2000/2010{
capture erase graph`num'.gph 
}
restore


